from django.contrib import admin
from django.urls import path,include
from .views import test_index1,test_index_JS,test_index_require_GET,Test_View_class1,Test_View_class2,Test_View_class3
from .views import session1,session2,session3
from django.views.decorators.http import require_GET, require_http_methods

fn1 = Test_View_class1.as_view()
fn2 = Test_View_class2.as_view()
fn3 = Test_View_class3.as_view()
urlpatterns = [
    # 视图，视图类
    path('视图函数1_文本响应', test_index1),  # /emp/ 后的路由走二级路由
    path('视图函数2_JSON响应', test_index_JS),
    path('视图函数3_限制请求方法为get',test_index_require_GET),
    path('View_class1', fn1),  # 视图类测试
    path('View_class2', fn2),  # 视图类测试 + 限制装饰器
    path('View_class3', require_GET(fn3)), # 视图类测试 + 限制装饰器
    # Session和Cookie
    path('session1',session1), # 简单给request加set-cookie
    path('session2', session2),  # 持久化保存session
    path('session3', session3),  # Session清除
]